#ifndef _CHARACTER_H_
#define _CHARACTER_H_

#include <string>
#include <boost/property_tree/ptree.hpp>

#include "include/GlobalGameObj.h"

using namespace std;
using namespace boost::property_tree;

class Character
{
public:
	struct BasicInfo
	{
		// basic info
		int character_id;
		int player_id;
		string name;
		string gang_name;
		int rank;
		int gender;
		int level;
		int job;
		string title;

		int reward;
		int exp;
		int max_exp;
		int reputation;

		// basic properties
		int hp;
		int kongfu;
		int specialty;
		int theurgy;

		// shape
		int res_id;

		// equip bar
		string equip_pos_str;
		string equip_id_str;
		string ch_equip_id_str;

		// fight info
		string skill_id_str;
		string formation_str;

		// pet
		string pet_id_str;
		string pet_name_str;
		string pet_level_str;

		// scene
		int online;
		string scene_id;
		int speed;
		string last_online_time;

		// system related
		string created;
		string updated;
	};

	struct DetailInfo
	{
		int character_id;
		string name;
		int job;
		string skill_id_str;
		int head_id;
		int level;
		int hp;
		int attack;
		int defence;
		int specialty_attack;
		int specialty_defence;
		int theurgy_attack;
		int theurgy_defence;
		int critical;
		int toughness;
		int hit;
		int dodge;
		int destroy;
		int parry;
		int angry;
		int prior_attack;

		// system related
		string created;
		string updated;
	};

	static void GetBasicInfo(GlobalGameObj *p_game_obj, int character_id, BasicInfo *p_info);
	static void GetDetailInfo(GlobalGameObj *p_game_obj, int character_id, DetailInfo *p_info);
	static void GetBasicInfoTree(GlobalGameObj *p_game_obj, int character_id, ptree &info_tree);
	static void GetDetailInfoTree(GlobalGameObj *p_game_obj, int character_id, ptree &info_tree);
	static void UpdateBasicInfo(GlobalGameObj *p_game_obj, BasicInfo *p_info);
	static void UpdateDetailInfo(GlobalGameObj *p_game_obj, DetailInfo *p_info);
	static void CreateBasicSqlStr(BasicInfo *p_info, string &sql_str);
	static void CreateDetailSqlStr(DetailInfo *p_info, string &sql_str);
	static void CreateBasicInfo(GlobalGameObj *p_game_obj, BasicInfo *p_info);
	static void CreateDetailInfo(GlobalGameObj *p_game_obj, DetailInfo *p_info);
};

#endif
